package com.example.studykotlin.kotlin_actual_combat.KotlinDocument.Adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.studykotlin.R

/**
 *描述:
 *创建者：pjh
 *创建日期：2021/12/21
 *UpdateUser:更新者
 *更新时间：2021/12/21
 *更新说明：
 */
class PageJumpAdapter(private val data: MutableList<String>) : RecyclerView.Adapter<PageJumpAdapter.Holder>(){
    class Holder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        var name: TextView = itemView.findViewById(R.id.tv_text)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.adapter_item_list, parent, false)
        return Holder(view)
    }

    override fun onBindViewHolder(holder: Holder, position: Int) {
        holder.name.text = data[position]
    }

    override fun getItemCount(): Int {
        return data.size
    }
}